package org.swxjava.util;

public class LogFactory {

	private static final Byte LOG_IMPL_COMMONS = 1;

	private static Byte implType = null;

	private static final Log LOG = LogFactory.getLog(LogFactory.class);
	
	static {
		try {
			Class.forName("org.apache.commons.logging.LogFactory");
			implType = LOG_IMPL_COMMONS;
			LOG.info("Logging system using : Apache commons Logging");
		} catch (ClassNotFoundException e) {
			// do nothing
			LOG.info("Logging system using : SWX system out logger");
		}
	}

	public static final Log getLog(Class clazz) {
		Log log = null;
		if (implType == LOG_IMPL_COMMONS) {
			log = new CommonsLoggingLogWrapper(clazz);
		} else {
			log = new SystemOutLogWrapper(clazz);
		}
		return log;
	}

}
